package com.fand.site.validator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

import com.fand.common.service.CommonService;

import com.fand.site.dto.SiteDeLoDto;

/**
 * 站默认日志
 *
 * @author yaoHT
 * 
 */
@Component(SiteDeLoValidator.BEAN_ID)
public class SiteDeLoValidator implements Validator {
	public static final String BEAN_ID = "com.fand.site.validator.SiteDeLoValidator";
	
	/**
	 * 公共服务
	 */
	@Qualifier(CommonService.BEAN_ID)
	@Autowired(required = false)
	private CommonService commonService;
	
	@Override
	public boolean supports(Class<?> clazz) {
		return SiteDeLoDto.class.equals(clazz);
	}
	
	@Override
	public void validate(Object target, Errors errors) {
		SiteDeLoDto siteDeLo = (SiteDeLoDto) target;
		
		//if (StringUtils.isBlank(siteDeLo.getCode())) {
		//	errors.reject("siteDeLo.code.required", "编号不能为空");
		//}
	}
}
